<template>
  <div class="app-container form-demo">
    <el-card class="box-card" shadow="always" :body-style="{ padding: '20px' }">
      <div class="header">
        <el-radio-group v-model="type" @change="selectChange" style="margin-right: 20px">
          <el-radio-button label="经手人" value="0"></el-radio-button>
          <el-radio-button label="产品分类" value="1"></el-radio-button>
        </el-radio-group>
        <el-button type="warning" icon="Download" @click="handleExport">导出</el-button>
      </div>
      <el-table
        ref="table"
        show-summary
        border
        v-loading="loading"
        :data="dataSource"
        @selection-change="handleSelectionChange"
        @row-dblclick="dbclick"
      >
        <el-table-column label="#" type="index" width="100" align="center"> </el-table-column>
        <el-table-column label="经手人" align="center" prop="userName" v-if="type == 0" />
        <el-table-column label="产品分类" align="center" prop="parentClassifyName" v-if="type == 1" />
        <el-table-column label="本月新增续费数量" align="center" prop="currentPayOrderSum" width="180" />
        <el-table-column label="续费中数量" align="center" prop="noFollowOrderSum" />
        <el-table-column label="续费中金额（元）" align="center" prop="noFollowOrderAmountSum" />
        <el-table-column label="输单金额" align="center" prop="overdueAmountSum" />
        <el-table-column label="赢单数量转换率" align="center" prop="successRate" />
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        v-model:page.sync="queryParams.pageNum"
        v-model:limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
  </div>
</template>

  <script>
import listMixin from '@/mixins/listMixin';
export default {
  name: 'PayFee',
  mixins: [listMixin],
  data() {
    return {
      queryParams: {
        // Query parameters for the table
        orderNo: '', // 方案名称
        creator: '', // 制单人
        pageNum: 1,
        pageSize: 10
      },
      dateRange: [], // Date range for the created time
      type: 0,
      urls: {
        list: '/order/payOrder/listByOperationManager'
      }
    };
  },

  mounted() {
    this.listSysUser();
  },
  watch: {
    listUrl() {
      return;
    }
  },
  methods: {
    getQueryParams() {
      let params = Object.assign({}, this.queryParams);
      params.params = { ...this.params };
      if (this.dateRange && this.dateRange.length) {
        params.params['beginCreateTime'] = this.dateRange[0];
        params.params['endCreateTime'] = this.dateRange[1];
      }
      return params;
    },
    handleLink(row) {
      this.$refs.quotationListDialog.show(row);
    },
    selectChange(e) {
      this.urls.list = this.type == 1 ? '/order/payOrder/listByCategoryId' : '/order/payOrder/listByOperationManager';
      this.getList();
    },

    /** 导出按钮操作 */
    handleExport() {
      const url = this.type == 1 ? '/order/payOrder/exportByCategoryId' : '/order/payOrder/exportByOperationManager';
      this.download(url, {}, `缴费分析_${new Date().getTime()}.xlsx`);
    }
  }
};
</script>
  <style type="text/css" scoped>
.box-card {
  margin-top: 10px;
}
.header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
</style>
  <style type="text/css">
.form-demo .el-form-item .el-form-item__content {
  width: 215px;
}
</style>
